<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"
import="Entity.*"
%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">  <!-- 以上代码告诉IE浏览器，IE8/9及以后的版本都会以最高版本IE来渲染页面。 -->  
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>实验细节</title>
	<link rel="stylesheet" href="http://localhost:8080/OpenExperimentManagementSystem/css/normalize.css">
	<link rel="stylesheet" href="http://localhost:8080/OpenExperimentManagementSystem/css/common.css">
	<link rel="stylesheet" type="text/css" href="http://localhost:8080/OpenExperimentManagementSystem/css/room_operate.css">
  </head>
  <script type="text/javascript">
  		function validateForm() {
    var x = document.forms["myForm"]["score"].value;
    if (x == null || x == "") {
        alert("需要输入分数");
        return false;
    }else if(x<0||x>100){
    	alert("分数应为1-100的整数");
    	return false;
    }
    return true;
}
  </script>
 
<%
List<Selection> list=(List<Selection>)request.getAttribute("list");
String tid=(String)request.getAttribute("tid");
String url=(String)request.getAttribute("url");
String tname=(String)request.getAttribute("tname");
String eid=(String)request.getAttribute("eid");
String name=(String)request.getAttribute("name");
String num=(String)request.getAttribute("num");
String sta="打分";
 %>
  
  <body style="background:url(images/back6.jpg);background-size:100% 100% ; background-attachment: fixed"
  style="padding:20px;">
	<header>
		<div class="logo">
		<a href="http://cs.njust.edu.cn/">
			<img src="http://localhost:8080/OpenExperimentManagementSystem/images/cslogo.png" style="width: 80px;height: 80px;margin-left: 250px;margin-top: 20px;" >
		</a>
			<h1 class="vertical-center">开放性实验辅助管理系统</h1>
		</div>
		<div class="logoff">
			<a href="#"><span><em class="username"><%=tname %></em>（<em class="usernum"><%=tid %></em>）</span></a>
			<em>实验名:<%=name%>|指导老师工号:<%=tid %>|指导老师：<%=tname%>|
    		报名总数：<%=num%></em>
			<a href="servlet/MyExpServlet?tid=<%=tid%>&tname=<%=tname%>" id="logout"><img src="http://localhost:8080/OpenExperimentManagementSystem/images/out.png" alt="返回"></a>
		</div>
	</header><!-- header结束 -->
	<div class="container" style="margin:20px auto;">
		<div class="content">
			<div class="M00" style="min-height: 400px; _height: 400px;">
			    <table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor="#e1e1e1" class="List_T">
			        <tr>
			            <td align="center" bgcolor="#b8b8b8">
			                <strong>学生名</strong>
			            </td>
			        	<td align="center" bgcolor="#b8b8b8">
			        	    <strong>学工号</strong>
			        	</td>
			        	<td align="center" bgcolor="#b8b8b8">
			        	    <strong>分数</strong>
			        	</td>
			        	<td align="center" bgcolor="#b8b8b8">
			        	    <strong>打分</strong>
			        	</td>
			        	<td align="center" bgcolor="#b8b8b8" style="width: 158px; ">
			        	    <strong>
			        	    	<form action="${pageContext.request.contextPath}/servlet/UploadServlet" enctype="multipart/form-data" method="post">  <br/>
									<input type="hidden" name="tid" value=<%=tid %>>
									<input type="hidden" name="tname" value=<%=tname %>>
									<input type="hidden" name="identity" value="2">
									<input type="hidden" name="eid" value=<%=eid %>>  						
			 		     			<input type="file" name="file" required="required">
			 		     			<% if(url!=null&&url!=""&&!"NULL".equals(url)&&!"null".equals(url)){ %>
			 		     					（模板已上传）
			 		     			<% } %>
			  						<input type="submit" value="上传实验模板">
								</form>	
			        	    </strong>
			        	</td>
			        </tr>
			    <%
			   if(list!=null){
			   		for(int i=0;i<list.size();i++){
			   		Selection t=list.get(i);
			   		if(t!=null){
			    %>
			        <tr>
			            <td align="center" bgcolor="#FFFFFF">
							<%=t.getStu_name() %>
			            </td>
			            <td align="center" bgcolor="#FFFFFF">
							<%=t.getStu_number() %>
			            </td>
			            <form name="myForm" action="servlet/MyExpServlet" onsubmit="return validateForm()" method="get">
			            	<input type="hidden" name="op" value="setScore">
				    		<input type="hidden" name="sid" value=<%=t.getId() %>>
				    		<input type="hidden" name="url" value=<%=url %>>
				    		<input type="hidden" name="eid" value=<%=eid %>>
				    		<input type="hidden" name="Expid" value=<%=eid %>>
				    		<input type="hidden" name="ExpTe_num" value=<%=tid %>>
				    		<input type="hidden" name="ExpTe_name" value=<%=tname %>>
				    		<input type="hidden" name="name" value=<%=name %>>
			    		<%
			    		if(t.getIsreport()==0){//placeholder="name"
			    		 %>
			                <input type="hidden" name="score" value="0">
			            <td align="center" bgcolor="#FFFFFF">
			                <input type="text"  placeholder="未提交报告 score=0">
			            </td>
			            <%
			    		}else{
			    		 %>
			            <td align="center" bgcolor="#FFFFFF">
			                <input type="text" name="score" required="required" value=<%=t.getGrade()%> >
			            </td>
			            <%
			    		}
			    		%>
			            <td align="center" bgcolor="#FFFFFF">
			                <input type="submit" value="打分">
			            </td>
			         </form>
			         	<%
			    		if(t.getIsreport()==0){
			    		 %>
			            <td align="center" bgcolor="#FFFFFF">
			                <%="未提交报告" %>
			            </td>
			            <%
			    		}else{
			    		 %>
			    		 <td align="center" bgcolor="#FFFFFF">
			                <a href="servlet/DownloadServlet?filename=<%=t.getStuURL()%>">下载实验报告</a>
			            </td>
			            <% } %>
			        </tr>
			       <%  }}} %>
				</table>
			</div>
			
		</div>
	</div>
	
</body>
 
</html>
